import req from '@/utils/request.js';
import * as URL from '@/constants/api.js';
import { GOODS_SKU } from '../constants/api.js';


// 商品详情
export function getGoodsDetail(id) {
  return req({
    url: URL.GOODS_DETAIL,
    params: {
      id,
    },
  })
    .then((res) => res.data.result)
    .catch(() => {});
}
// 商品SKU详情
export function getGoodsSkuDetail(id) {
  return req({
    url: URL.GOODS_SKU + id,
  })
    .then((res) => res.data.result)
    .catch(() => {});
}
// 商品同类推荐
export function getGoodsRelevant(id) {
  return req({
    url: URL.GOODS_RELEVANT,
    params: {
      id,
      limit: 16,
    },
  })
    .then((res) => res.data.result)
    .catch(() => {});
}
// 24小时热榜
export function getHotRank(id) {
  return req({
    url: URL.HOT_RANK,
    params: {
      id,
      limit: 3,
      type: 1,
    },
  })
    .then((res) => res.data.result)
    .catch(() => {});
}
// 周榜
export function getWeekRank(id) {
  return req({
    url: URL.HOT_RANK,
    params: {
      id,
      limit: 3,
      type: 2,
    },
  })
    .then((res) => res.data.result)
    .catch(() => {});
}


